#ifndef SENSOR_COMMON_H
#define SENSOR_COMMON_H

#include "algo_include.h"


// Constant definition

#define SECONDS_PER_MINUTE  60
#define MINUTES_PER_HOUR    60
#define HOURS_PER_DAY       24
#define SECONDS_PER_HOUR    ( SECONDS_PER_MINUTE * MINUTES_PER_HOUR )
#define MINUTES_PER_DAY     ( MINUTES_PER_HOUR * HOURS_PER_DAY )
#define SECONDS_PER_DAY     ( SECONDS_PER_HOUR * HOURS_PER_DAY )


// TYPEDEF

typedef enum
{
    EVENT_SIGNAL,
    EVENT_IMPEDANCE,
    EVENT_CALIBRATION,
    COUNT_EVENTS
} sensor_event_desc;


typedef struct
{
    uint32 u32_counter;
    uint32 u32_period;
} sensor_period_timer;


// Public function declaration

logical CountToDo( sensor_period_timer *tp_timer );
logical CheckToDo( sensor_period_timer const *tp_timer );

fixed32 FirFilter( cycle_buffer const *tp_buffer );
fixed32 ChangePerMinute( cycle_buffer const *tp_buffer );
fixed32 ChangePerMinuteFilt( cycle_buffer const *tp_buffer );


#endif // SENSOR_COMMON_H
